// pages/sugar_record/sugar_record.js
import config from '../../mars/conf/config'
let api = require("../../mars/services/api.js");
let that;
Page({
   data: {
      foodId: "406",
   },
   onLoad: function (options) {
      // 页面初始化 options为页面跳转所带来的参数
      that = this;
      let mealName = options.meal || 'breakfast';
      that.setData({
         mealActive: mealName
      })
   },
   onReady: function () {
      // 页面渲染完成
   },
   onShow: function () {
      // 页面显示
      that.refreshData(that.data.mealActive);
   },
   onHide: function () {
      // 页面隐藏
   },
   onUnload: function () {
      // 页面关闭
   },
   refreshData(mealName) {
     
   },
   navigate: function (data) {
      let foodType = data.currentTarget.dataset.foodtype;
      let target = that.data.target[that.data.mealActive][foodType];
      wx.navigateTo({
         url: '/pages/calorieFoodEdit/calorieFoodEdit?meal=' + this.data.mealActive +
         "&foodType=" + foodType +
         "&target=" + target,
      });
   },
})



